<%--
 *  File:    MyNotesSummary.jsp
 *  @Author: Tony Wang
 *  Date:    4/22/2002 11:46AM
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom-tag.tld" prefix="custom" %>

<%
  	//init param
  	HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  	if (userinfo==null)
  	  userinfo = new HashMap();
  	Category cat = Category.getInstance("jsp.MyNotesSummary");
	String privilegeCode = "Z0404,L302";
  	String strModuleName = "BIEE";
  	String strClassType = "";
  	String strTableName = "ovnotes";
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>MyNotesSummary</title>
<PageFlow:CheckPageFlow pageName="mynotessummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js">
</script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<%@include file="/inc/SummaryDivision.inc"%>

<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "MyNotesSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function clickIt(id)
{
  	cform.currentid.value = id;
  <%--[SCRIPT]  	window.alert(id);  [SCRIPT]--%>

}
function page_click(id)
{
    	document.cform.actionname.value = "click";
    	document.cform.notesid.value = id;
    	<%--[SCRIPT]  window.alert(id);  [SCRIPT]--%>
  	document.cform.target="_self";
  	isRunning = true;
  	document.cform.submit();
}
function page_delete()
{   
	if (cform.numrows.value<1)
		return;
	var check = false;
	if(cform.numrows.value==1)
	{
	  if(cform.notesids.checked)
	  {
	    if(cform.status0.value!=99)
	    {
	      alert('<%= message.getMessageDesc("NOTES_CLOSE_TO_DELETE") %>');
  			return;
	    }
	     check = true;
	  }
	}
	else
	{
  	with (document.cform)
  	{
  	    for (var i=0;i<cform.numrows.value;i++)
  		{
  		    if (cform.notesids[i].checked)
  			{   
  				var o =  eval("status" + i);
  				if (o.value != 99)
  				{
  					alert('<%= message.getMessageDesc("NOTES_CLOSE_TO_DELETE") %>');
  					return;
  				}
  			    check = true;
  			}
  		}
  	}
  }
	if (!check)
	{
		alert('<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>');
		return;
	}

	
     var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
     if(!flag)
       return;
	document.cform.actionname.value = "delete";
 	document.cform.target="_self";
 	isRunning = true;
  document.cform.submit();
}


</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<form name="cform" method="post" action="../Dispatcher">
    <input type="hidden" name="pagename" value="mynotessummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

    
	<%@ include file="/inc/PageLocation.inc" %>

<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr> 
    <td class="summary_top"> 
    <table width="100%" border="0" cellspacing="0">
     <%@ include file="/inc/SummarySearch.inc" %>
    </table>
    </td>
  </tr>
  <tr> 
    <td> 
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr class="deepblue-left"> 
            <td width="22" class="title_center" >&nbsp;</td>
            <td class="title_center"><a href="javascript:page_summary('orderby','title')"><%= label.getLabelName("L_Title") %></a></td>          
            <td width="90" class="title_center" ><%= label.getLabelName("L_RelatedEvents") %></td>
            <td width="110" class="title_center"><%= label.getLabelName("L_Subject") %></td>
            <td width="80" class="title_center" ><%= label.getLabelName("L_Resource") %></td>
             <td width="105" class="title_center" ><%= label.getLabelName("L_SourceOrg") %></td>
            <td width="70" class="title_center" nowrap><a href="javascript:page_summary('orderby','begindate')"><%= label.getLabelName("L_BuildDate") %></a></td>
            <td width="40" class="title_center" nowrap><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_Status") %></a></td>
          </tr>


	<%
		Vector mynotessummary = (Vector)pageContext.getAttribute("mynotessummary");
		if(mynotessummary == null){
  			mynotessummary = new Vector();
  		}
  		cat.debug("Vector mynotessummary is---***"+mynotessummary);
		Integer nDefaultId = new Integer(-1);
		String  strPageidname = "mynotessummary";
		int i=0;
	%>
        <input type="hidden" name="numrows" value="<%=JspHelper.filterNull( mynotessummary.size() )%>">
	<logic:iterate id="ps" collection="<%= mynotessummary %>" indexId="orderId">
	<%
		HashMap psMap = (HashMap)ps;
		String strIsChecked = "";
		
		if((orderId.intValue())%2 == 1){
			strClassType = "td-listrom";
		}
		else{
			strClassType = "none";
		}
		if(orderId.intValue()==0){
			strIsChecked = "Checked";
      	nDefaultId = (Integer)(psMap.get("notesid"));
		}
	%>
              
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  class="<%=JspHelper.filterNull( strClassType )%>"> 
            <td>
	 	<input type="checkbox" id = "d<%=JspHelper.filterNull( i)%>" name="notesids" value="<%=JspHelper.filterNull( psMap.get("notesid"))%>" class="checkbox">
     	    </td>
            <td><a href="javascript:page_click(<%=JspHelper.filterNull( psMap.get("notesid") )%>)"><oval:write name="ps" property="title"/></a>&nbsp;</td>
            <td>&nbsp;<%= OvalTools.buildMyNotesURL((String)psMap.get("subjectcode"),(Integer)psMap.get("transactionid"),(String)psMap.get("transactioncode"),strLanguageCode,"MyNotesSummary.jsp?" + OvalTools.randomURL()) %></td>
            <td>&nbsp;<oval:write name="ps" property="subjectname"/></td>
            <td>&nbsp;<oval:write name="ps" property="fromusername"/></td>
            <td>&nbsp;<oval:write name="ps" property="fromorgshortname"/></td>
            <td>&nbsp;<custom:dateWrite name="ps" property="begindate"/></td>
	    <input type="hidden" name="status<%=JspHelper.filterNull( i)%>"  value="<%=JspHelper.filterNull( psMap.get("status"))%>">
            <td>&nbsp;<oval:write name="ps" property="statusname"/></td>
            <%
            	i++;
            %>
          </tr>
	</logic:iterate>
			<input type="hidden" name="currentid" value="<%=JspHelper.filterNull( nDefaultId )%>">
			<input type="hidden" name="notesid" >
			
        	<%@ include file="/inc/SummaryAction.inc" %>
      </table>
    </td>
  </tr>
  <tr> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
        <tr> 
          <td class="td_center">
		  <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>		  
		  </td>
        </tr>
      </table>


  </tr>
</table>
</form>
</body>
<%
  Vector vErrorCode=(Vector)session.getAttribute("errorcode");
  if(vErrorCode!=null && vErrorCode.size()>0)
  { 
    for(int ij=0;ij<vErrorCode.size();ij++)
    {
      HashMap hmTmp=(HashMap)vErrorCode.get(ij);
      if(hmTmp==null)
        continue;
      else
      {
        String strmsg=OvalTools.replaceQuot(message.getMessageDesc(hmTmp,session));
%>
        <script>
          alert("<%=JspHelper.filterNull(strmsg)%>");
        </script>
<%
        break;
      }
    }
    session.removeAttribute("errorcode");
  }
%>
</html>


